package com.itwmk.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itwmk.entity.Orders;
import com.itwmk.service.impl.OrderService;
import com.itwmk.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

/**
 * @author wmk
 */
@Slf4j
@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     *
     * @param orders
     * @return
     */
    @PostMapping("submit")
    public R<String> submit(@RequestBody Orders orders){
        orderService.mySubmit(orders);
        return R.success("下单成功");
    }

    /**
     *
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("userPage")
    public R<Page> queryOrders(int page,int pageSize){
        Page page1 = orderService.queryWhitDetail(page, pageSize);
        return R.success(page1);
    }
}
